<?php

declare(strict_types=1);

namespace App\Chat\Controller;

use App\Chat\Annotation\ChatAuth;
use App\Chat\Constant\DealStatusConstant;
use App\Chat\Request\TalkUserExtendInfoRequest;
use App\Chat\Service\ChTalkUserExtendInfoService;
use App\Chat\Service\TalkContactService;
use Hyperf\Di\Annotation\Inject;
use Hyperf\HttpServer\Annotation\Controller;
use Hyperf\HttpServer\Annotation\PostMapping;

#[Controller(prefix: 'ch/chat/contact'),ChatAuth]
class TalkContactController extends ChatBaseController
{

    #[Inject]
    protected TalkContactService $service;

    #[Inject]
    protected ChTalkUserExtendInfoService $extendInfoService;


    #[PostMapping('getInfo')]
    public function getInfo()
    {
        return $this->success($this->service->getInfo($this->request->all()));
    }

    /**
     * 企业标签
     * @return \Psr\Http\Message\ResponseInterface
     * @throws \Psr\Container\ContainerExceptionInterface
     * @throws \Psr\Container\NotFoundExceptionInterface
     */
    #[PostMapping('getWxWorkTagList')]
    public function getWxWorkTagList(): \Psr\Http\Message\ResponseInterface
    {
        return $this->success($this->service->getWxWorkTagList($this->request->all()));
    }

    /**
     * 个人标签
     * @return \Psr\Http\Message\ResponseInterface
     * @throws \Psr\Container\ContainerExceptionInterface
     * @throws \Psr\Container\NotFoundExceptionInterface
     */
    #[PostMapping('getWxTagList')]
    public function getWxTagList(): \Psr\Http\Message\ResponseInterface
    {
        return $this->success($this->service->getWxTagList($this->request->all()));
    }

    /**
     * 智能标签
     * @return \Psr\Http\Message\ResponseInterface
     * @throws \Psr\Container\ContainerExceptionInterface
     * @throws \Psr\Container\NotFoundExceptionInterface
     */
    #[PostMapping('getSmartTagList')]
    public function getSmartTagList(): \Psr\Http\Message\ResponseInterface
    {
        return $this->success($this->service->getSmartTagList($this->request->all()));
    }

    /**
     * 设置企业标签
     * @return \Psr\Http\Message\ResponseInterface
     * @throws \Psr\Container\ContainerExceptionInterface
     * @throws \Psr\Container\NotFoundExceptionInterface
     */
    #[PostMapping('setWxWorkTag')]
    public function setWxWorkTag(): \Psr\Http\Message\ResponseInterface
    {
        return  $this->service->setWxWorkTag($this->request->all()) ? $this->success('设置成功') : $this->error('设置失败');
    }

    /**
     * 设置个人标签
     * @return \Psr\Http\Message\ResponseInterface
     * @throws \Psr\Container\ContainerExceptionInterface
     * @throws \Psr\Container\NotFoundExceptionInterface
     */
    #[PostMapping('setWxTag')]
    public function setWxTag(): \Psr\Http\Message\ResponseInterface
    {
        return  $this->service->setWxTag($this->request->all()) ? $this->success('设置成功') : $this->error('设置失败');
    }

    /**
     * 设置智能标签
     * @return \Psr\Http\Message\ResponseInterface
     * @throws \Psr\Container\ContainerExceptionInterface
     * @throws \Psr\Container\NotFoundExceptionInterface
     */
    #[PostMapping('setSmartTag')]
    public function setSmartTag(): \Psr\Http\Message\ResponseInterface
    {
        return  $this->service->setSmartTag($this->request->all()) ? $this->success('设置成功') : $this->error('设置失败');
    }

    /**
     * 设置企业标签
     * @return \Psr\Http\Message\ResponseInterface
     * @throws \Psr\Container\ContainerExceptionInterface
     * @throws \Psr\Container\NotFoundExceptionInterface
     */
    #[PostMapping('setRemark')]
    public function setRemark(): \Psr\Http\Message\ResponseInterface
    {
        return  $this->service->setRemark($this->request->all()) ? $this->success('设置成功') : $this->error('设置失败');
    }


    /**
     * 设置企业标签
     * @return \Psr\Http\Message\ResponseInterface
     * @throws \Psr\Container\ContainerExceptionInterface
     * @throws \Psr\Container\NotFoundExceptionInterface
     */
    #[PostMapping('setDesc')]
    public function setDesc(): \Psr\Http\Message\ResponseInterface
    {
        return  $this->service->setDesc($this->request->all()) ? $this->success('设置成功') : $this->error('设置失败');
    }

    /**
     * 设置企业标签
     * @return \Psr\Http\Message\ResponseInterface
     * @throws \Psr\Container\ContainerExceptionInterface
     * @throws \Psr\Container\NotFoundExceptionInterface
     */
    #[PostMapping('setMobile')]
    public function setMobile(): \Psr\Http\Message\ResponseInterface
    {
        return  $this->service->setMobile($this->request->all()) ? $this->success('设置成功') : $this->error('设置失败');
    }

    /**
     * 获取用户扩展信息
     * @param TalkUserExtendInfoRequest $request
     * @return \Psr\Http\Message\ResponseInterface
     * @throws \Psr\Container\ContainerExceptionInterface
     * @throws \Psr\Container\NotFoundExceptionInterface
     */
    #[PostMapping('getExtInfo')]
    public function getExtInfo(TalkUserExtendInfoRequest $request): \Psr\Http\Message\ResponseInterface
    {
        return $this->success($this->extendInfoService->getInfo($request->all()));
    }

    /**
     * 获取成交情况
     * @return \Psr\Http\Message\ResponseInterface
     * @throws \Psr\Container\ContainerExceptionInterface
     * @throws \Psr\Container\NotFoundExceptionInterface
     */
    #[PostMapping('getDealStatusList')]
    public function getDealStatusList(): \Psr\Http\Message\ResponseInterface
    {
        return $this->success(DealStatusConstant::getOptions());
    }

    /**
     * 保存用户扩展信息
     * @param TalkUserExtendInfoRequest $request
     * @return \Psr\Http\Message\ResponseInterface
     * @throws \Psr\Container\ContainerExceptionInterface
     * @throws \Psr\Container\NotFoundExceptionInterface
     */
    #[PostMapping('saveUserExtInfo')]
    public function saveUserExtInfo(TalkUserExtendInfoRequest $request): \Psr\Http\Message\ResponseInterface
    {
        return $this->extendInfoService->saveUserExtInfo($request->all()) ? $this->success('保存成功') : $this->error('保存失败');
    }
}